// core
import { createApp } from "vue"
import App from "@/App.vue"
import store from "@/store"
import router from "@/router"
import "@/router/permission"
// @ts-expect-error
import horizontalScroll from "el-table-horizontal-scroll"
import {
  Button,
  Form,
  Field,
  Cell,
  CellGroup,
  Uploader,
  Popup,
  Loading,
  Cascader,
  Toast,
  Checkbox,
  List,
  Icon,
  Overlay,
  Dialog,
  PullRefresh,
  Card,
  Swipe,
  SwipeItem,
  Image as VanImage
} from "vant" // load
import { loadSvg } from "@/icons"
import { loadPlugins } from "@/plugins"
import { loadDirectives } from "@/directives"
// css
import "uno.css"
import "normalize.css"
import "element-plus/dist/index.css"
import "element-plus/theme-chalk/dark/css-vars.css"
import "vxe-table/lib/style.css"
import "vxe-table-plugin-element/dist/style.css"
import "@/styles/index.scss"
import "vant/lib/index.css"
// 引入 eCharts
import * as echarts from "echarts"

const app = createApp(App)
app.config.globalProperties.$echarts = echarts
/** 加载插件 */
loadPlugins(app)
/** 加载全局 SVG */
loadSvg(app)
/** 加载自定义指令 */
loadDirectives(app)

app.use(store).use(router)
app
  .use(Uploader)
  .use(Button)
  .use(Form)
  .use(Field)
  .use(Cell)
  .use(CellGroup)
  .use(Popup)
  .use(Cascader)
  .use(Toast)
  .use(Checkbox)
  .use(List)
  .use(Icon)
  .use(Overlay)
  .use(Loading)
  .use(Dialog)
  .use(VanImage)
  .use(PullRefresh)
  .use(Card)
  .use(Swipe)
  .use(SwipeItem)
  .use(horizontalScroll)
router.isReady().then(() => {
  app.mount("#app")
})
